package com.wangjinhai.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 王金海
 * @Description:
 * @Date: Created by Administrator on 2018/8/14.
 * @Modified By:
 */
@RestController
public class UserController {

    @Value("${server.port}")
    private String port;

    @GetMapping("sayHi")
    public String sayHi(@RequestParam(value = "message") String message) {
        System.out.println("我休息了！");
        try {
            Thread.sleep(Long.parseLong(message));
        } catch (InterruptedException e) {
            System.err.println("异常"+e);
        }
        System.out.println(message+"秒后在叫我吧！");
        return String.format("Hi，your message is : %s i am from port : %s", message, port);
    }
}
